home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Gold Collection
/
Software Vault - The Gold Collection (American Databankers) (1993).ISO
/
cdr48
/
vdl020d.zip
/
VCOPY.DOC
< prev
next >
Wrap
Text File
|
1993-04-14
|
11KB
|
312 lines
{
════════════════════════════════════════════════════════════════════════════
Visionix File Copy Unit (VCOPY)
Copyright 1991,92,93 Visionix
ALL RIGHTS RESERVED
────────────────────────────────────────────────────────────────────────────
Revision history in reverse chronological order:
Initials Date Comment
──────── ──────── ────────────────────────────────────────────────────────
mep 03/26/93 Fixed bug with "Append" command. Also added use of
VType.maxArrSize variable.
mep 03/23/93 Updated show parameter and added to "CallBack" stuff.
mep 03/12/93 Added External "CallBack" Procedure for user interface.
mep 02/12/93 Fixed bug with ListFile (EOF).
mep 02/11/93 Cleaned up code for beta release
jrt 02/08/93 Sync with beta 0.12 release
mep 01/24/93 Few minor bug fixes.
mep 12/22/92 General cleanup of code.
mep 12/18/92 Deleted: SHOWFILES, SHOWATTR.
Added: SHOW=FADTPS
mep 12/16/92 Now allowed to place wildcards, target paths, and
additional parameters per line in a list file
(see below for usage).
Ranged dates are now allowed by using multiple
DATE/TIME parameter fields.
Added new parameters: DATEOA, DATEOB, TIMEOA, and TIMEOB.
mep 12/09/92 New functionality throughout unit.
Fixed VCopySetFlag and VCopyClearFlag to work with
the LongInt flag. Also fixed some bugs.
Added new parameters: TESTMODE, TARGETDIRONLY,
and SHOWATTR.
Added @ListFile for selected file copies.
Changed MAKEDIR command to MAKETARGETDIR.
mep 12/06/92 Moved some functions to VGen
jrt 11/21/92 Sync with beta 0.08
mep 11/19/92 Added most of the planned functionality.
mep 11/04/92 First logged revision.
────────────────────────────────────────────────────────────────────────────
}
Unit VCopy;
Uses
DOS,
VTypes,
VGen,
VDOSHigh,
VDates;
Const
{-------------------}
{ VCopy error codes }
{-------------------}
erVCopy_None = 0;
erVCopy_SamePath = 1;
erVCopy_NoExistFileFrom = 2;
erVCopy_NoExistFileTo = 3;
erVCopy_NoExistDirFrom = 4;
erVCopy_NoExistDirTo = 5;
erVCopy_NoRoom = 6;
erVCopy_Timeout = 7;
erVCopy_ListFileNotFound = 9;
erVCopy_TargetPathIsFile = 10;
Const
{---------------------------}
{ Call Back Events }
{ }
{ HiWord = Selective Events }
{ LoWord = Global Events }
{---------------------------}
cbeSourceOpen = $00000001;
cbeTargetOpen = $00000002;
cbeReadBlock = $00000004;
cbeWriteBlock = $00000008;
cbeExternReadBlock = $00010000;
cbeExternWriteBlock = $00020000;
cbeSourceClose = $00000010;
cbeTargetClose = $00000020;
cbeIOErr = $00000040;
cbeVCopyErr = $00000080;
cbeAll = $0000FFFF;
Type
TCopyCallBackInfo = RECORD
Event : LONGINT;
StrParam : PSTRING;
NumParam1 : LONGINT;
NumParam2 : LONGINT;
PtrParam1 : POINTER;
RetCode : LONGINT
END;
PCopyCallBackInfo = ^TCopyCallBackInfo;
{----}
TCopyCallBackProc = Procedure( CBI : PCopyCallBackInfo );
PCopyCallBackProc = ^TCopyCallBackProc;
{────────────────────────────────────────────────────────────────────────────}
Function VCopyFileEx( stPathFrom : PathStr;
stPathTo : PathStr;
Params : STRING;
CBFlags : LONGINT;
CBProc : PCopyCallBackProc ) : INTEGER;
Function VCopyFile( stPathFrom : PathStr;
stPathTo : PathStr;
Params : STRING ) : INTEGER;
{ ══════════════════════════════════════════════════════════════════════════
stPathFrom ... [d:][path]filespec(s) for source of copy. Wildcards allowed.
or
... @[d:][path]listfile - get filespec(s) from this text file.
(see notes below).
stPathTo ... [d:][path]filespec(s) for target. Wildcard-mask allowed.
Params ... the 23 defined parameters:
MOVE Move instead of copy.
NOOVERWRITE Do not overwrite duplicate target file.
SUBDIR Copy source directory and all subdirectories.
SHOW=FADTPS Show each file's general info:
Filename, Attributes, Date, Time, Packed-date, or Size.
ATTR=ASHR Search mask for source attributes types:
Archive, System, Hidden, and Readonly
EXACTATTR Each found source file needs to be exactly the above
attribute mask in order to be copied.
NEWER Copy only if target doesn't exist or source is newer.
SHARE Use file-sharing/locking for copy.
TIMEOUT=SSS Timeout for events (like SHARE).
APPEND Append source file(s) to single target file.
DATE=MM-DD-YY Copy file(s) ON this date.
DATEB=MM-DD-YY Copy file(s) BEFORE this date.
DATEA=MM-DD-YY Copy file(s) AFTER this date.
DATEOB=MM-DD-YY Copy file(s) ON or BEFORE this date.
DATEOA=MM-DD-YY Copy file(s) ON or AFTER this date.
TIME=HH:MM Copy file(s) AT this time.
TIMEB=HH:MM Copy file(s) BEFORE this time.
TIMEA=HH:MM Copy file(s) AFTER this time.
TIMEOB=HH:MM Copy file(s) ON or BEFORE this time.
TIMEOA=HH:MM Copy file(s) ON or AFTER this time.
MAKETARGETDIR Create the target directory if it does not exist.
Otherwise, stPathTo will be thought as the target
filename (wildcard) mask.
TARGETDIRONLY Do not create target subdirectories to match source
subdirectories; instead, copy all source filespecs
only to the main target directory.
TESTMODE Do everything as usual except the actual copying.
--------------------------------------------------------------------------
NOTES:
■ There are no set order for parameters to be passed in - only that
there be no spaces in the string and that commas are used between
all parameters.
■ Share parameter is for network environments, where a source/target file
might be opened by someone else. In order to insure system integrity,
VCopy will keep polling on the file until it becomes available or a
timeout occurs.
■ Timeout for events defaults to 30 seconds.
■ VCopy is fully compliant with VMulti for background file and multiple
file copying.
■ When using a listfile, it is a valid ASCII file containing line-by-line
valid filenames (including exact path if not in default directory)
with three parameters per line (the second two are optional) -
(1) Source filespec, (2) target filespec, and (3) additional parameters.
Spacing between these three parameters is not significant.
Usage: SourcePath [TargetPath] [/AdditionalParams]
Although the TargetPath is optional (defaults to stPathTo if
not present), the SourcePath must be present for a copy to occur.
If additional parameters are needed for a specific line, just
add them the same way the parameters are originally passed in,
except remember to add a "/" BEFORE the additional parameter list.
EXAMPLES:
#1 Copy COMMAND.COM to drive E root directory.
VCopyFile('C:\COMMAND.COM','E:\','');
#2 Move all of drive D to drive E's TEST directory and show files.
It will create directory TEST if not there. In addition, this
will create all of the target directories under the main source
directory and place the target files accordingly.
VCopyFile('D:\', 'E:\TEST', 'MOVE,SUBDIR,MAKETARGETDIR,SHOW=F');
#3 Copy all files with ONLY the Hidden and System attributes set
from drive C to drive A.
VCopyFile('C:\', 'A:\', 'SUBDIR,SHOW=F,ATTR=HS,EXACTATTR');
#4 Copy all files in subdirectory DOS that match the wildcard pattern
to subdirectory B (create if not exist) with a different mask.
VCopyFile('\DOS\*.COM', '\B\*.BIN', 'SHOW=F,MAKETARGETDIR');
#5 Copy all files from subdirectory TEST1 to subdirectory TEST2
in week of 01-03-93 to 01-09-93. Note that these directories
are considered in the "current/default" directory; if not, make
sure the full path for each is supplied.
VCopyFile('TEST1', 'TEST2', 'DATEOA=01-03-93,DATEOB=01-09-93');
#6 Copy all of drive D to drive E's TEST directory and show files.
(see example #2). The difference is that the target directories
will not be created; rather, all of the matching source files
will only go into the TEST directory.
VCopyFile('D:\', 'E:\TEST', 'SUBDIR,MAKETARGETDIR,TARGETDIRONLY,SHOW=F');
#7 Copy all the files inside listfile C:\DIR.LST into subdirectory
D:\TEST with default parameters - each line will add to this set.
VCopyFile('@C:\FILE.LST', 'D:\TEST', 'SHOW=F,TARGETDIRONLY' );
The listfile 'C:\FILE.LST' looks like this:
---
C:\WINDOWS\HIMEM.SYS
F:\WP51\*.* C:\WP51 /MAKETARGETDIR,SUBDIR,SHOW=A
C:\DOS\C*.* D:\SHIP\*.BAT
---
The first pathspec "C:\WINDOWS\HIMEM.SYS" will be copied to
directory D:\TEST.
The second pathspec "F:\WP51\*.*" will copy all files in and under
that subdirectory to drive C subdirectory WP51 (and create it if
it doesn't exist), while showing each file's attribute set.
The third pathspec "C:\DOS\C*.*" will copy all files that match
the wildcards to D:\SHIP while renaming all files to *.BAT. Note
that the additional parameters toggled on the second line did not
occur on this line.
KNOWN BUGS:
■ In TestMode, the SubDir (actual directory creation/removal), NoOverwrite
and Newer flags do not function.
══════════════════════════════════════════════════════════════════════════ }
{────────────────────────────────────────────────────────────────────────────}